package com.padakeji.android.pworks.module.image.present;

import android.support.v7.app.AppCompatActivity;

import com.padakeji.android.pworks.module.image.entity.ImageDirectory;
import com.padakeji.android.pworks.module.image.model.ImageModel;
import com.padakeji.android.pworks.module.image.view.ImagePickerView;

import java.util.List;

/**
 * Created by AtanL on 2015/9/15.
 */
public class ImagePickerPresent {

    private AppCompatActivity mContext;
    private ImagePickerView v;
    private ImageModel imageModel;

    public ImagePickerPresent(AppCompatActivity context, ImagePickerView v) {
        this.mContext = context;
        this.v = v;

        imageModel = new ImageModel(this.mContext);
        imageModel.setOnImageLoadListener(new ImageModel.OnImageLoadListener() {
            @Override
            public void onImagesLoad(List<ImageDirectory> imageDirectories) {
                showImages(imageDirectories);
            }
        });

    }

    private void showImages(List<ImageDirectory> imageDirectories) {
        v.showImages(imageDirectories);
    }


    public void loadImages() {
        imageModel.loadImages();
    }

}
